import uasyncio as asyncio

# 定义两个协程任务
async def task1():
    while True:
        print("Task 1 is running...")
        await asyncio.sleep(1)

async def task2():
    led_state = False
    while True:
        led_state = not led_state
        print("LED is on" if led_state else "LED is off")
        await asyncio.sleep(0.5)

# 创建事件循环
loop = asyncio.get_event_loop()

# 将任务添加到事件循环
loop.create_task(task1())
loop.create_task(task2())

# 执行事件循环
loop.run_forever()
